async function sign_up() {
    username_input = document.querySelector("#username_input");
    password_input = document.querySelector("#password_input");
    password_input2 = document.querySelector("#password_verify");
    if (username_input.value === "" || password_input.value === ""
        || password_input2 === "") {
        alert("请填写完整信息");
        return;
    }
    if (password_input.value != password_input2.value) {
        alert("两次密码不一致");
        return;
    }
    //提交注册
    api = baseUrl + "/register/update";
    data = {
        "username": username_input.value,
        "password": password_input.value
    }
    fetch(api, {
        "method": "PUT",
        headers: {
            "Content-Type": "application/json",
        },
        body: JSON.stringify(data)
    }).then(response => response.json()).then(data => {
        console.log(data);
        if (data["code"] === 0) {
            showPopup("注册成功");
            window.location.href = "../index.html";
        } else {
            showPopup("注册失败");
        }
    })
        .catch(error => {
            console.error(error);
        })
}